package hwi.sevenc.ddangdda.game;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.view.View;

public class GameCanvasView extends View {

	
	
	int lastX=-1;
	int lastY=-1;
	final Paint mPaint;
	
	Bitmap mBitmap;
	Canvas mCanvas;
	public GameCanvasView(Context context) {
		super(context);
		this.mPaint = new Paint();
		this.mPaint.setColor(Color.BLACK);
		
		this.lastX = -1;
		this.lastY = -1;

	}
	
	public void stop_draw(){
		lastX = -1;
		lastY = -1;
		
	}
	
	public void start_draw(int X, int Y){
		if (lastX != -1) {
			
				mCanvas.drawLine(lastX, lastY, X, Y, mPaint);
			
		}
		
		// set the last coordinates
		lastX = X;
		lastY = Y;
	}
	
	public void process_draw(int X, int Y){
		if (lastX != -1) {
			mCanvas.drawLine(lastX, lastY, X, Y, mPaint);
		}

		lastX = X;
		lastY = Y;
	}
	
	
	protected void onDraw(Canvas canvas) {
		if (mBitmap != null) {
			canvas.drawBitmap(mBitmap, 0, 0, null);
		}
	}

}
